@extends('Admin.layouts.common')

@section('content')
    <div class="container myContainer">

        @if ($errors->any())
            <div class="alert alert-danger">
                <ul>
                    @foreach ($errors->all() as $error)
                        <li>{{ $error }}</li>
                    @endforeach
                </ul>
            </div>
        @endif

        <form id="defaultForm" action="/order/ajax_update_detail" method="post">
            {{ csrf_field() }}
            <div class="form-group">
                <label class="control-label">商品:</label>
                {{ $product->product_name }}<br />
                <img src="{{$product->thumb_img}}" style="max-width: 200px" >
            </div>
            <div class="form-group">
                <label class="control-label">Uid:</label>
                {{$order->uid}}
            </div>
            <div class="form-group">
                <label class="control-label">订单号:</label>
                {{$order->order_no}}
            </div>
            <div class="form-group">
                <label class="control-label">金额:</label>
                {{$order->amount}}
            </div>
			
            <div class="form-group">
                <label class="control-label">支付方式:</label>
                {{$order->payment_id==1?'微信':'支付宝'}} {{$order->tra_id}}
            </div>

            <div class="form-group">
                <label class="control-label">支付方式:</label>

                {{$order_pay_status[$order->pay_status]}}
            </div>

            <div class="form-group">
                <label class="control-label">快递状态:</label>
                {{$order_ship_status[$order->ship_status]}}
            </div>
            <div class="form-group">
                <label class="control-label">下单时间:</label>
                {{ date("Y/m/d H:i:s",$order->add_time) }}
            </div>
            <div class="form-group">
                <label class="control-label">付款时间:</label>
                @if($order->pay_time)
                {{ date("Y/m/d H:i:s",$order->pay_time) }}
                 @else
                -
                @endif
            </div>
            <div class="form-group">
                <label class="control-label">发货时间:</label>
                @if($order->ship_time)
                {{ date("Y/m/d H:i:s",$order->ship_time) }}
                @else
                -
                @endif
            </div>

             <div class="form-group">
                <label class="control-label">手机号:</label>
                {{ $order->phone }}
            </div>
            <div class="form-group">
                <label class="control-label">姓名:</label>
                {{ $order->real_name }}
            </div>
            <div class="form-group">
                <label class="control-label">地址:</label>
                {{ $order->address }}
            </div>
            <div class="form-group">
                <label class="control-label">邮编:</label>
                {{ $order->post_code }}
            </div>

            


            @if($order->ship_status==0)
            <div class="form-group">
                <label class="control-label">快递公司:</label>
                <select name="ship_name" class="form-control">
                    <option value="">请选择快递公司</option>
                    @foreach($order_ship_name as $key=>$name)
                    <option value="{{$key}}" @if($name==$order->ship_name) selected="selected" @endif > {{$name}}</option>
                    @endforeach
                </select>
            </div>

            <div class="form-group">
                <label class="control-label">收货人省份:</label>
                <input name="province" type="text" class="form-control" value="">
            </div>
            <div class="form-group">
                <label class="control-label">收货人城市:</label>
                <input name="city" type="text" class="form-control" value="">
            </div>
            <div class="form-group">
                <label class="control-label">收货人地区:</label>
                <input name="area" type="text" class="form-control" value="">
            </div>
            <div class="form-group">
                <label class="control-label">收货人地址:</label>
                <input name="address" type="text" class="form-control" value="">
            </div>
            <div class="form-group">
                <input type="hidden" name="id" value="{{$order->id}}">
                <button class="btn btn-primary btn-block" type="submit">保存</button>
            </div>
            @endif
            


            

        </form>
    </div>
@endsection


@section('foot')
<script src="{{ asset('libs/bootstrapvalidator-master/dist/js/bootstrapValidator.min.js') }}?v=<?=config('version')?>"></script>
<link href="{{ asset('libs/bootstrapvalidator-master/dist/css/bootstrapValidator.min.css') }}?v=<?=config('version')?>" rel="stylesheet" type="text/css">
<script type="text/javascript">
$(document).ready(function() {
    $('#defaultForm').bootstrapValidator({
        message: 'This value is not valid',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        excluded:[":disabled"],
        fields: {
            province: {
                validators: {
                    notEmpty: {},
                }
            },
            ship_name: {
                validators: {
                    notEmpty: {},
                }
            },
            ship_no:{
                validators: {
                    notEmpty: {},
                }
            },
            city:{
                validators: {
                    notEmpty: {},
                }
            },
            area:{
                validators: {
                    notEmpty: {},
                }
            },
            address:{
                validators: {
                    notEmpty: {},
                }
            },
        }
    });
});
</script>
@endsection
